package com.fy.dao;

import com.fy.entity.Ac_info;
import org.apache.ibatis.annotations.*;
import org.mapstruct.Mapper;

import java.util.List;

@Mapper
public interface Ac_infoMapper {
    @Select("select * from ac_info ORDER BY ac_like DESC")
    List<Ac_info> findAll();
    @Select("select * from  ac_info where ac_id=#{ac_id}")
    List<Ac_info> getInfo(@Param("ac_id") String ac_id);
    @Insert("INSERT into ac_info(ac_id,ac_pic,ac_title,ac_author,info_id,ac_info,ac_like,ac_add,ac_collection,ac_state)values(#{ac_id},#{ac_pic},#{ac_title},#{ac_author},#{info_id},#{ac_info},#{ac_like},#{ac_add},#{ac_collection},#{ac_state})")
    int insert_ac_info(@Param("ac_id") String ac_id,@Param("ac_pic") String ac_pic,@Param("ac_title") String ac_title,
                       @Param("ac_author") String ac_author,@Param("info_id") String info_id,@Param("ac_info") String ac_info,
                       @Param("ac_like") int ac_like,@Param("ac_add") String ac_add,@Param("ac_collection") int ac_collection,
                       @Param("ac_state") String ac_state);
    @Delete("DELETE from ac_info where ac_id = #{ac_id}")
    int delete_ac_info(@Param("ac_id") String ac_id);
    @Update("update ac_info set ac_like=#{ac_like},ac_collection=#{ac_collection} where ac_id=#{ac_id}")
    int update_ac_info(@Param("ac_like")int ac_like,@Param("ac_collection")int ac_collection,
                       @Param("ac_id")String ac_id);
    @Update("Update ac_info set restrictions=#{restrictions} where ac_id=#{ac_id} ")
    int update_renshu(@Param("restrictions")int restrictions,
                      @Param("ac_id")String ac_id);
}
